function menuClick(url) {
	$("frame[name='main1']", parent.document).attr("src", url);
}

function createfatherMenu() {
	ajaxUtils("", projectName + "/menu/fatherCreate.do", function(result) {
		if (result.state == 0) {
			$("#menu").empty();
			var jsonObj = result.obj;
			var str = "<ul>";
			for (var index = 0; index < jsonObj.length; index++) {
				str = str + "<li><a href=\"javascript:volid(0);\" "
						+ "onclick=\"createMenu(this)\">"
						+ jsonObj[index].unitName + "</a><div></div></li>";
			}
			str = str + "</ul>";
			$("#menu").append(str);
		} else {
			showError(result.msg);
		}
	});
}

function createMenu(viewObj) {
	if ($(viewObj).siblings("div").children().length > 0) {
		$(viewObj).siblings("div").empty();
		return;
	}
	ajaxUtils("", projectName + "/menu/create.do", function(result) {
		if (result.state == 0) {
			var jsonObj = result.obj;
			var str = "<ul>";
			for (var index = 0; index < jsonObj.length; index++) {
				str = str + "<li><a href=\"javascript:volid(0);\" "
						+ "onclick=\"showChild(this,'" + jsonObj[index].id + "','" + jsonObj[index].deptName + "')\">" + jsonObj[index].deptName
						+ "</a><div></div></li>";
			}
			str = str + "</ul>";
			$(viewObj).siblings("div").append(str);
		} else {
			showError(result.msg);
		}
	});
}
function showChild(viewObj, parentMenuCode,deptName) {
	if ($(viewObj).siblings("div").children().length > 0) {
		$(viewObj).siblings("div").empty();
		return;
	}
	ajaxUtils({
		"parentMenuCode" : parentMenuCode
	}, projectName + "/menu/createChild.do", function(result) {
		if (result.state == 0) {
			$(viewObj).siblings("div").empty();
			var jsonObj = result.obj;
			var str = "<ul>";
			for (var index = 0; index < jsonObj.length; index++) {
				str = str + "<li><a href=\"javascript:volid(0);\" "
						+ "onclick=\"showChild(this,'" + jsonObj[index].id + "','" + jsonObj[index].deptName + "')\">" + jsonObj[index].deptName
						+ "</a><div></div></li>";
			}
			str = str + "</ul>";
			$(viewObj).siblings("div").append(str);
		} else {
			showError(result.msg);
		}
	});
	menuClick(projectName+"/user/selectListUser.do?deptId="+parentMenuCode+"&deptName="+deptName);
}


